package com.yc.framework.utils;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.CharacterIterator;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.text.StringCharacterIterator;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * 字符串处理工具类
 */
public class StringUtil {
	public static HashMap<String, String> escapeCharMap = new HashMap<String, String>();
	static {
		escapeCharMap.put("<", "&lt;");
		escapeCharMap.put(">", "&gt;");
		escapeCharMap.put("&", "&amp;");
		escapeCharMap.put("\"", "&quot;");
		escapeCharMap.put("'", "&apos;");
	}

	/**
	 * utf8解转码
	 * Description :.
	 * 
	 * @param str the str
	 * 
	 * @return the string
	 */
	public static String utf8Decoder(String str) {
		try {
			if(isEmpty(str)){
				return str;
			}
			return URLDecoder.decode(str, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return str;
	}
	
	/**
	 * utf8转码 
	 * Description :.
	 * 
	 * @param str the str
	 * 
	 * @return the string
	 */
	public static String utf8Encoder(String str){
		try {
			if(isEmpty(str)){
				return str;
			}
			return URLEncoder.encode(str,"UTF-8");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return str;
	}
	
	/**
	 * 屏蔽手机号码 中间4位
	 * 
	 * @param mobile
	 * @return 136****8888
	 */
	public static String shieldMobile(String mobile) {
		if (isEmpty(mobile)) {
			return null;
		}
		return mobile.substring(0, 3) + "****" + mobile.substring(7, 11);
	}

	/**
	 * 返回随机 length 位 字符 包括 数字和字母大小写
	 * @param length 几位 
	 * @return length 位 字符串
	 */
	public static String getRodamCode(int length){
		Random rand = new Random(); // 设置随机种子
		String base = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTYVWXYZ";
        int size = base.length();
        StringBuffer str = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int start = rand.nextInt(size);
            String tmpStr = base.substring(start, start + 1);
            str.append(tmpStr);

        }
		return str.toString();
	}
	/**
	 * put string array into map with a key, this method will return the detail
	 * information of array This method can be used in servlet for log many
	 * parameter array, and you can not worry about NULL POINT EXCEPTION see
	 * main method
	 * 
	 * @param map
	 * @return
	 */
	public static String ArrayToString(Map<String, String[]> map) {
		String res = "";
		for (String key : map.keySet()) {
			String[] values = map.get(key);
			if (values != null) {
				res = res + key + "=[";
				for (String value : values) {
					res = res + value + ",";
				}
				if (res.length() - res.lastIndexOf(",") == 1) {
					res = res.substring(0, res.lastIndexOf(","));
				}
				res = res + "],";
			} else {
				res = res + key + "=NULL,";
			}

		}
		if (res.length() - res.lastIndexOf(",") == 1) {
			res = res.substring(0, res.lastIndexOf(","));
		}
		return res;
	}

	// 版本规范是0~9999.0~9999.0~9999
	public static boolean checkVersion(String version) {
		if (version == null || "".equals(version)
				|| version.split("\\.").length != 3) {
			return false;
		}
		try {
			String[] numbers = version.split("\\.");
			for (int i = 0; i < numbers.length; i++) {
				Long num = Long.parseLong(numbers[i]);
				if (num > 9999L || num < 0L)
					return false;
			}
		} catch (Exception e) {
			return false;
		}
		return true;
	}

	/**
	 * 截取字符串
	 * @param str
	 * @param end
	 * @return
	 */
	public static String subString(String str,int end){
		if(isEmpty(str)){
			return str;
		}
		int length = str.length();
		if(end >= length){
			return str;
		}
		return str.substring(0,end);
	}

	/**
	 * 下载文件
	 * 
	 * @param file
	 * @param response
	 */
	public static void downloadFile(String file, HttpServletResponse response) {
		String filename = file.substring(file.lastIndexOf(File.separator) + 1);
		response.setContentType("application/x-msdownload");
		response.setHeader("Content-Disposition", "attachment; filename="
				+ filename); // no
		// file
		// path.

		try {
			BufferedOutputStream bos = new BufferedOutputStream(response
					.getOutputStream());
			BufferedInputStream bis = new BufferedInputStream(
					new FileInputStream(file));
			byte[] buf = new byte[4096];
			while (bis.available() > 0) {
				int len = bis.read(buf);
				bos.write(buf, 0, len);
			}
			bos.flush();
			bos.close();
			bis.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 
	 * 根据转义列表对字符串进行转义(escape)。
	 * 
	 * @param source
	 *            待转义的字符串
	 * 
	 *            转义列表
	 * 
	 * @return 转义后的字符串
	 */

	public static String escapeCharacter(String source) {
		if (source == null || source.length() == 0) {
			return source;
		}
		if (escapeCharMap.size() == 0) {
			return source;
		}
		StringBuffer sb = new StringBuffer(source.length() + 100);
		StringCharacterIterator sci = new StringCharacterIterator(source);
		for (char c = sci.first();

		c != CharacterIterator.DONE;
		c = sci.next()) {
			String character = String.valueOf(c);
			if (escapeCharMap.containsKey(character)) {
				character = (String) escapeCharMap.get(character);
			}
			sb.append(character);
		}

		return sb.toString();

	}


	/**
	 * 返回一个字符串所占用的字节个数
	 * 
	 * @param str
	 *            源字符串
	 * @return 字符串所占用的字节数，如"我ABC"占用5个字节
	 */
	public static int getByteCount(String str) {
		int len = 0;
		if (str == null) {
			return len;
		}
		for (int i = 0; i < str.length(); i++) {
			int codePoint = str.codePointAt(i);
			if (codePoint > 0xFF) { // 中文字符
				len += 2;
			} else {
				len++;
			}
		}
		return len;
	}


	/**
	 * 判断是否为合法的日期时间字符串
	 * 
	 * @param str_input
	 * @return boolean;符合为true,不符合为false
	 */
	public static boolean isDate(String str_input, String rDateFormat) {
		if (!isNull(str_input)) {
			SimpleDateFormat formatter = new SimpleDateFormat(rDateFormat);
			formatter.setLenient(false);
			try {
				formatter.format(formatter.parse(str_input));
			} catch (Exception e) {
				return false;
			}
			return true;
		}
		return false;
	}

	/**
	 * 判断是否是Email
	 * 
	 * @param email
	 * @return
	 */
	public static boolean isEmail(String email) {
		String check = "^([a-z0-9A-Z]+[-|\\._]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
		Matcher matcher = Pattern.compile(check).matcher(email);
		return matcher.matches();
	}
	
	/**
	 * 随机生成length长度的数字字符串
	 * @param length
	 * @return
	 */
	public static String validCode(int length)
	{
		String validCodeStr = "";
		Random random = new Random();
		for(int i=0;i<length;i++)
		{
			validCodeStr+=random.nextInt(10);
		}
		
		return validCodeStr;
	}

	/**
	 * 判断字符串是否为NULL或者空字符串
	 * 
	 * @param str
	 * @return
	 */
	public static boolean isEmpty(String str) {
		if (str != null && !"".equals(str) && !"null".equals(str)) {
			return false;
		} else {
			return true;
		}
	}

	/**
	 * 判断字符串是否不为空
	 * 
	 * @param str
	 * @return
	 */
	public static boolean isNotEmpty(String str) {
		if (str != null && !"".equals(str) && !"null".equals(str)) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * 判断对象是否为NULL
	 * 
	 * @param str
	 * @return
	 */
	public static boolean isNull(Object str) {
		if (str == null)
			return true;
		else
			return false;
	}

	/**
	 * 将NULL转换成空字符串
	 * 
	 * @param value
	 * @return
	 */
	public static String null2Str(Object value) {
		return value == null || "null".equals(value.toString()) ? "" : value
				.toString();
	}

	/**
	 * 将NULL转换成空字符串
	 * 
	 * @param value
	 * @return
	 */
	public static String null2Str(String value) {
		return value == null || "null".equals(value) ? "" : value.trim();
	}


	/**
	 * 解析字符串 exp：str=zhangsan,lisi,wangwu;
	 * split(str,",")-->[zhangsan,lisi,wangwu]
	 * 
	 * @param string
	 * @param delim
	 * @return
	 */
	@SuppressWarnings( { "rawtypes", "unchecked" })
	public static final String[] split(String string, String delim) {
		StringTokenizer token = new StringTokenizer(string, delim);
		String[] result = new String[token.countTokens()];
		List tmp = new ArrayList();
		while (token.hasMoreTokens()) {
			tmp.add(token.nextToken());
		}
		tmp.toArray(result);
		return result;
	}

	/**
	 * String转换成Long
	 * 
	 * @param value
	 * @return
	 */
	public static Long stringToLong(String value) {
		Long l;
		value = null2Str(value);
		if ("".equals(value)) {
			l = 0L;
		} else {
			try {
				l = Long.valueOf(value);

			} catch (Exception e) {
				l = 0L;
			}
		}

		return l;
	}

	/**
	 * 按字节数来截取字符串，中文字母算2个字节，英文字节算1个字节。
	 * 
	 * @param str
	 *            要截取的源字符串
	 * @param byteCount
	 *            要取的字节数
	 * @return 返回截取的子串,如：substr("我ABC", 4)返回"我AB"，而 substr("我ABC汉DEF",
	 *         6)则返回"我ABC"
	 */
	public static String substr(String str, int byteCount) {
		if (str == null) {
			return null;
		}

		StringBuffer sb = new StringBuffer(str.length());
		int count = 0;
		for (int i = 0; i < str.length(); i++) {
			int codePoint = str.codePointAt(i);
			char ch = str.charAt(i);
			if (codePoint > 0xFF) { // 此为中文字符
				count += 2;
			} else {
				count++;
			}

			if (count > byteCount) {
				break;
			}
			sb.append(ch);
		}
		return sb.toString();
	}

	/**
	 * src以split分割后的数组是否包含key
	 * 
	 * @param src
	 * @param split
	 * @return true-包含，false-不包含
	 */
	public static boolean isContainsStrBySplit(String src, String split,
			String key) {
		if (isEmpty(src)) {
			return false;
		}

		String[] srcs = src.split(split);
		for (String _src : srcs) {
			if (_src.equals(key)) {
				return true;
			}
		}

		return false;
	}

	/**
	 * 判断是否是弱密码，true-是，false-不是<br>
	 * 1、不能是连续数字。2、不能是相同数字。3、不能是“189123”、“666888”。4、不能与用户名后六位相同
	 */
	public static boolean isPoolPwd(String username, String password) {
		boolean very = true;

		// 校验是否连续数字
		String[] t = password.split("|");
		int first = 0, next = 0, zd = 1, fd = -1;
		for (int i = 1; i < t.length; i++) {
			first = Integer.parseInt(t[i]);
			if (i > 1) {
				next = Integer.parseInt(t[i - 1]);
			} else {
				continue;
			}
			if ((next - first != zd) && (next - first != fd)) {
				very = false;
			}
		}
		if (very) {
			return true;
		}

		// 不能是相同数字
		very = true;
		for (int i = 1; i < t.length; i++) {
			first = Integer.parseInt(t[i]);
			if (i > 1) {
				next = Integer.parseInt(t[i - 1]);
			} else {
				continue;
			}

			if (next != first) {
				very = false;
				break;
			}
		}
		if (very) {
			return true;
		}

		// 不能是“189123”、“666888”
		if (password.equals("189123") || password.equals("666888")) {
			return true;
		}

		// 不能与用户名后6位相同
		if (username.substring(username.length() - 6, username.length())
				.equals(password)) {
			return true;
		}

		return false;
	}

	/**
	 * 字符串 编码
	 * 
	 * @param str
	 * @return
	 */
	public static String encodeString(String str) {
		try {
			str = URLEncoder.encode(str, "UTF-8");

		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}

		return str;
	}

	/**
	 * 字符串 转码
	 * 
	 * @param str
	 * @return
	 */
	public static String decodeString(String str) {
		try {
			str = URLDecoder.decode(str, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}

		return str;
	}

	/**
	 * 将sql语句中的名称参数替换为对应map里的值
	 * @param sql 参数以:key的形式传入
	 * @param params
	 * @return
	 */
	public static String buildSqlByParam(String sql, Map<String, Object> params) {
		Iterator<String> it = params.keySet().iterator();
		for(String name; it.hasNext();) {
			name = it.next();
			Object value = params.get(name);
			String _value = "";
			if(value instanceof Date) {
				_value = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(value);
			} else {
				_value = String.valueOf(value);
			}
			sql = sql.replaceAll(":" + name, _value);
		}
		
		return sql;
	}
	
	public static boolean isEmptyArray(String[] a) {
		if(a == null || a.length == 0) {
			return true;
		} else {
			return false;
		}
	}
	
	/**
	 * 获取x分钟后的时间
	 * @param x
	 * @return
	 */
	public static Date dateAfterMinut(int x) {    
        Date date = new Date();    
        Calendar cal = Calendar.getInstance();    
        cal.setTime(new Date());    
        cal.add(Calendar.MINUTE, x);// 24小时制    
        date = cal.getTime();    
        return date;    
    }   
	
//    /**
//     * 生成0.01-0.10之间的随机数字，精确到小数点后两位
//     */
//    public static Double randomNum(){
//    	Random random = new Random();
//
//        float f1 = (random.nextFloat() / 10 + 0.01f);
//        // 构造方法的字符格式这里如果小数不足2位,会以0补足.
//        return (Double)f1.;
//    }
    
    public static void main(String args[]){
    	String s = "<p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">心理健康教育【婚姻家庭科普教育包含其中】，这其实是每一个心理学从业者最最基本的技能，在学会个案咨询之前就应该会讲课。通过讲课，一方面提升自己的口才和知识储备；另一方面也是最好的聚人气方式、获得社会大众了解、信任和接纳讲者的机会。当然，并非所有咨询师都具备讲师的条件， 除了个人的口才等因素之外，拥有自己独创并被大众喜爱的课程特别重要。而要想打造出满足社会大众需求的课程产品，就需要讲者具备系统性、科学性的专业知识。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-family: 仿宋; font-size: 14px;\">在此，我们隆重推出中国社会科学院婚姻家庭研究与教育专家陈一筠教授的培训课程，供大家选择。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 黑体; color: red;\">陈一筠“婚姻家庭讲师”高级研修班</span><span style=\"font-size: 14px; font-family: 仿宋;\">，将传授陈教授几十年的研究与教育实践成果，从东西方社会文化的差异中探讨中国婚姻家庭演变的趋势、现状、存在的问题与解决方案，着力回答社会大众在婚姻家庭生活中的问题以及澄清父母在孩子教育理念与方法上存在的误区。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">课程全部内容的分享，需要</span><span style=\"font-size: 14px; font-family: 黑体; color: red;\">五天四晚</span><span style=\"font-size: 14px; font-family: 仿宋;\">的封闭训练，不仅适合于心理学工作者、婚姻家庭咨询师群体，同时适合普通的社会大众。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">【陈一筠教授简介】</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-family: 仿宋; font-size: 14px;\">陈一筠，女，1940年4月出生于四川省筠连县，成长于重庆市。1964年毕业于北京大学俄罗斯语言文学系。中国社会科学院研究员，青春期健康与情感教育专家；中国陶行知研究会青春期教育专业委员会名誉主任；中国婚姻家庭研究会专家委员会副主任。1993年获国务院授予的“社会科学领域特殊贡献专家 ”荣誉证书并享受政府特殊津贴。曾任《国外社会学》主编。出版了《现代男女的婚恋与性》、《两性世界何处去》、《婚姻家庭的科学咨询》、《走向婚姻》、《天涯何处觅佳偶？》、《婚姻旅程探幽》、《解读性的奥秘》等专著：主编了《青苹果丛书》（包括《男孩女孩长大了》、《少男少女知多少》、《爱在青春期》、《引领孩子度青春》等），其独到的学术见解和解决实际问题的方法，被社会各界人士广为接受和传播，深受广大专业人员、中青年读者和青少年及其家长们的喜爱。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-weight: bold; font-size: 14px; font-family: 黑体;\">课程大纲</span><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">第一天</span></strong><strong><span style=\"font-size: 14px; font-family: 宋体; color: red;\">&nbsp;&nbsp;</span></strong><strong>&nbsp;</strong><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">现代婚姻向何处去？</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style=\"font-size: 14px; font-family: 楷体;\">——社会转型期的婚恋趋势、问题、原因和对策</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第一讲：家庭是我国社会保障的基点</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第二讲：美国：婚姻家庭衰退、经济危机和美国梦的幻灭</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第三讲：中国传统型婚姻的功能及其维系纽带</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第四讲：现代婚姻的功能转换和维系因素对夫妻关系的挑战</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第五讲：婚姻成败对妇女儿童及社会的影响</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第六讲：影响现代婚恋关系的社会心理因素</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">自由择偶的心理风险——机遇的制约和变化的考验</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">浪漫激情为何不是婚姻成功的保证？</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"font-size: 14px; font-family: 仿宋;\">——难以把握的非理性：本能性、主观性、虚幻性</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">市场经济时代的社会环境因素对婚恋的影响</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第七讲：中外离婚趋势比较与离婚率的统计方法</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第八讲：离婚因素解析（社会、经济、道德、健康等层面）</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第九讲：关于对策的思考与建议（法制、教育、咨询救助及其他）</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">第二天</span></strong><strong><span style=\"font-size: 14px; font-family: 宋体; color: red;\">&nbsp;&nbsp;</span></strong><strong>&nbsp;</strong><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">婚姻的生命周期与夫妻关系调适（上）</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第一讲：何谓“婚姻的生命周期”？社会学如何划分“生命周期”？</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第二讲：婚姻幼稚期的两次角色转变（结婚头5年）</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">从恋人到夫妻的角色变化与心理适应</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">从夫妻到父母的亲职压力与夫妻关系</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">姻亲矛盾的影响因素与调适智慧</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第三讲：婚姻成长期的双重角色冲突（婚后5--15年）</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">性别角色的冲突</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">A.</span><span style=\"font-size: 14px; font-family: 仿宋;\">男主外、女主内天然合理吗？</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">B.</span><span style=\"font-size: 14px; font-family: 仿宋;\">“二保一”和全职太太的困局</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">工作世界与家庭世界的矛盾</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">A.</span><span style=\"font-size: 14px; font-family: 仿宋;\">以效益代替公平的市场经济法则与价值观</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">B.</span><span style=\"font-size: 14px; font-family: 仿宋;\">职场压力、合理家务分担与夫妻平等</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">C.</span><span style=\"font-size: 14px; font-family: 仿宋;\">“女主外，男主内”如何？</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第三讲：中年夫妻的多事之秋（结婚15--35年）</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">审美疲劳与心理疲劳在夫妻关系中的反映</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">妻子更年期与丈夫的心理适应及角色扮演</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">夫妻性生活失调的原因与对策</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">4.</span><span style=\"font-size: 14px; font-family: 仿宋;\">更年期遭遇青春期——“两期战争”的平息之道</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">5.</span><span style=\"font-size: 14px; font-family: 仿宋;\">妻子更年期的特殊保健与护理</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; color: red;\">&nbsp;</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">第三天</span></strong><strong><span style=\"font-size: 14px; font-family: 宋体; color: red;\">&nbsp;</span></strong><strong>&nbsp;</strong><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">婚姻的生命周期与夫妻关系调适（下）</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第一讲：夕阳无限好</span></strong><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;</span></strong><strong>&nbsp;</strong><strong><span style=\"font-size: 14px; font-family: 黑体;\">人间重晚情</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">老年夫妻的双重角色丧失及其心理适应</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">老年的健康与疾病</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">老年夫妻的情感与性</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">4.</span><span style=\"font-size: 14px; font-family: 仿宋;\">丧偶老人的再婚与同居</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第二讲：现代社会的男女交往与“婚外情”现象解析</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">现代已婚男女的大千世界与两人世界</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">异性交往中的“磁场反应”与情感滋养</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">夫妻之间可以有隐私吗</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">4.</span><span style=\"font-size: 14px; font-family: 仿宋;\">现代夫妻可以有隐私吗？</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">5.</span><span style=\"font-size: 14px; font-family: 仿宋;\">危险的“迷恋”——婚外情的信号</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">6.</span><span style=\"font-size: 14px; font-family: 仿宋;\">设防“办公室恋情”</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">7.</span><span style=\"font-size: 14px; font-family: 仿宋;\">男女在对待“婚外情事故”上的态度差异及其原因</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">8.</span><span style=\"font-size: 14px; font-family: 仿宋;\">外遇有救吗？——关于配偶“出格”的原因、性质与对策</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第三讲：婚姻生活与性和谐</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">婚姻关系的三要素（激情、承诺、性生活）</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">性爱与婚姻</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">夫妻性生活障碍：原因与对策</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">4.</span><span style=\"font-size: 14px; font-family: 仿宋;\">关于性取向——同性恋、双性恋及其他</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">第四天</span></strong><strong><span style=\"font-size: 14px; font-family: 宋体; color: red;\">&nbsp;</span></strong><strong>&nbsp;</strong><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">青春健康与青年男女的恋爱择偶</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第一讲：解读青春密码——青春健康与“早恋”</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">青春期的释义与三大性证</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">青春期少男少女的双重困顿</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">青春期教育的狭义和广义层面</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">4.</span><span style=\"font-size: 14px; font-family: 仿宋;\">青春期教育的宗旨与价值观</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">5.</span><span style=\"font-size: 14px; font-family: 仿宋;\">爱在青春期——关于异性友情与爱情</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">6.</span><span style=\"font-size: 14px; font-family: 仿宋;\">家庭是培育爱的学校</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">7.</span><span style=\"font-size: 14px; font-family: 仿宋;\">关于少男少女的交往——“早恋”还是“早练”？</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">8.</span><span style=\"font-size: 14px; font-family: 仿宋;\">青春少男少女渴望隐私关怀——少女怀孕、堕胎与杀婴</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">9.</span><span style=\"font-size: 14px; font-family: 仿宋;\">建立三道方火墙，维护未成年人的性健康与生殖健康</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">10.</span><span style=\"font-size: 14px; font-family: 仿宋;\">生命教育视野下的青春期教育</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal;\"><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;&nbsp;&nbsp;</span></strong><strong><span style=\"font-size: 14px; font-family: 黑体;\">第二讲 天涯何处觅知音——</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><strong><span style=\"font-size: 14px; font-family: 黑体;\">关于现代男女的恋爱、择偶、同居与性健康</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">婚前异性交往的性质与功能（从友情到爱情）</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">自由择偶与婚姻责任（机遇和变化的双重风险）</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">从一见钟情到承诺终生（非理性与理性的博弈）</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">4.</span><span style=\"font-size: 14px; font-family: 仿宋;\">选择人生伴侣要考虑的主要条件（文化、价值观、性格与年龄）</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">5.</span><span style=\"font-size: 14px; font-family: 仿宋;\">对婚前交往过程的评估与结婚的审慎抉择</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">6.</span><span style=\"font-size: 14px; font-family: 仿宋;\">关于婚前同居与“试婚”</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">7.</span><span style=\"font-size: 14px; font-family: 仿宋;\">选择配偶犹如选择原材料，幸福婚姻是创造的成果</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">8.</span><span style=\"font-size: 14px; font-family: 仿宋;\">婚前检查、婚房、婚礼与蜜月</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\"><br/></span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">第五天</span></strong><strong><span style=\"font-size: 14px; font-family: 宋体; color: red;\">&nbsp;</span></strong><strong>&nbsp;</strong><strong><span style=\"font-size: 14px; font-family: 黑体; color: red;\">婚姻家庭辅导与救助</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第一讲：婚姻是爱情的坟墓吗？</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第二讲：病态爱情种种</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第三讲：男女性障碍的医学与心理学解析</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第四讲：我们需要婚前契约和夫妻AA制吗？</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第五讲：男人出轨“三部曲”</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第六讲：夫妻吵架</span></strong><strong><span style=\"font-size: 14px; font-family: 宋体;\">&nbsp;</span></strong><strong>&nbsp;</strong><strong><span style=\"font-size: 14px; font-family: 黑体;\">约法三章</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第七讲：关于家庭暴力的心理与法律干预</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第八讲：关于离婚的社会救助——“试离婚”如何？</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">第九讲：关于完善我国婚姻家庭相关政策法规的探讨</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\"><br/></span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">课程附加值：</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-family: 仿宋; font-size: 14px;\">所有参加陈一筠教授课程的心理咨询师、婚姻家庭咨询师学员，赠送华众健康集团董事长、国内著名婚姻家庭问题咨询专家因缘老师《婚姻家庭方向品牌课程研发秘籍》系统培训一次，并协助学员研发自己的课程，价值8000元，帮助参训学员打造出属于自己的课程体系，建构专属的课程产品矩阵。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">招生对象：</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">有志于从事婚姻家庭教育与咨询的社会工作者、教师、医生</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">具有心理咨询师相关资格证书【心理咨询师等级证书、婚姻家庭咨询师等级证书等】，有待提高自己执业能力的专业人士</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">希望学习爱情知识的青年男女，想要获得经营和维护婚姻家庭的经验与智慧，提升自己婚姻家庭生活质量的夫妻，渴望掌握青春期孩子成长规律，正确引领孩子度青春的广大中小学生家长。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><strong><span style=\"font-size: 14px; font-family: 黑体;\">培训目的和发展机遇：</span></strong></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">1.</span><span style=\"font-size: 14px; font-family: 仿宋;\">建立、完善“中国婚姻家庭援助联盟”合作体系，培训一批能够讲授婚姻智慧或者亲子教育课程、能够推动当地婚姻家庭教育咨询事业发展的成员。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">2.</span><span style=\"font-size: 14px; font-family: 仿宋;\">解决学员自身在经营婚姻和教育孩子方面可能存在的问题。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">3.</span><span style=\"font-size: 14px; font-family: 仿宋;\">为各地的家长学校系统培训讲师。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">4.</span><span style=\"font-size: 14px; font-family: 仿宋;\">建立“爱情与人生”讲师人才库，优秀学员直接与公司签订就业合同，加入“爱情与人生婚姻家庭讲师团”。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\">5.</span><span style=\"font-size: 14px; font-family: 仿宋;\">经陈一筠教授和“爱情与人生婚姻家庭讲师团”授权，获得相关课程的讲授资格的学员，可在某地区或全国开展授权课程的收费培训。</span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"font-size: 14px; font-family: 仿宋;\"><br/></span></p><p style=\"margin-top: 4px; margin-bottom: 4px; white-space: normal; text-indent: 33px;\"><span style=\"color: rgb(255, 0, 0);\"><span style=\"font-family: 黑体, SimHei;\"><strong><span style=\"font-size: 14px;\">关</span></strong></span><span style=\"color: rgb(255, 0, 0); text-indent: 33px; font-family: 黑体, SimHei;\"><strong><span style=\"font-size: 14px;\">于报名：</span></strong><span style=\"font-size: 14px;\">1、</span></span><span style=\"color: rgb(255, 0, 0); text-indent: 33px; font-size: 14px; font-family: 仿宋;\">付费后，联系因缘老师，微信：love80241；QQ：329660457；2、填写地址时，正常填写就可以，在“备注说明”一栏，填写上QQ号或者微信号，便于客服联系</span><span style=\"font-size: 14px; font-family: 仿宋;\"></span></span></p>";
    	System.out.println(Html2Text(s));
    }

	/**
     * 获取XML文本中指定标签的内容
	 * @throws Exception 
     */
    public static String getXmlValue(String text, String key) throws Exception {
    	if(!text.contains(key)) {
    		throw new Exception("不包含此标签");
    	}
    	int index = text.indexOf(key);
    	return text.substring(index + key.length(), text.indexOf("</", index));
    }
    
    /**
     * 去除CDATA标签
     * @throws Exception 
     */
    public static String deleteCDATA(String text) throws Exception {
    	return text.substring(text.indexOf("A[") + 2, text.lastIndexOf("]]"));
    }
    
	/**
	 * 格式化double类型值，使得其末尾保留两位小数
	 * 
	 * @param value
	 * @return
	 */
	public static String formatDouble(double value) {
		DecimalFormat df = new DecimalFormat("######0.00");
		return df.format(value);
	}
	
	// 得到IP地址
	public static String getIpAddr(HttpServletRequest request) {
		String ip="";
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("X-Real-IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("Proxy-Client-IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("WL-Proxy-Client-IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("HTTP_CLIENT_IP");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getHeader("HTTP_X_FORWARDED_FOR");
		}
		if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
			ip = request.getRemoteAddr();
		}
		return ip;
	}
	
	/**
	 * 将map中的key和value按照&key=value&形式拼接返回
	 * @param req
	 * @return
	 */
	public static String mapToGet(Map<String, Object> req) {
		String ret = "";
		for(Iterator<String> it = req.keySet().iterator(); it.hasNext();) {
			String key = it.next();
			ret += (key + "=" + req.get(key) + "&");
		}
		return ret.substring(0, ret.length() - 1);
	}

	/**
	 * 将map中的key和value按照xml形式拼接返回
	 * @param req
	 * @return
	 */
	public static String mapToXml(Map<String, Object> req) {
		String ret = "";
		for(Iterator<String> it = req.keySet().iterator(); it.hasNext();) {
			String key = it.next();
			ret += ("<" + key + ">" + req.get(key) + "</" + key + ">");
		}
		return ret;
	}
	
	/**从html中提取纯文本*/
	public static String Html2Text(String inputString){
	     String htmlStr = inputString; //含html标签的字符串
	     String textStr ="";
	     Pattern p_script;
	     Matcher m_script;
	     Pattern p_style;
	     Matcher m_style;
	     Pattern p_html;
	     Matcher m_html;

	    try{
	          String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>"; //定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script> }
	          String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>"; //定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style> }
	          String regEx_html = "<[^>]+>"; //定义HTML标签的正则表达式

	          p_script = Pattern.compile(regEx_script,Pattern.CASE_INSENSITIVE);
	          m_script = p_script.matcher(htmlStr);
	          htmlStr = m_script.replaceAll(""); //过滤script标签

	          p_style = Pattern.compile(regEx_style,Pattern.CASE_INSENSITIVE);
	          m_style = p_style.matcher(htmlStr);
	          htmlStr = m_style.replaceAll(""); //过滤style标签

	          p_html = Pattern.compile(regEx_html,Pattern.CASE_INSENSITIVE);
	          m_html = p_html.matcher(htmlStr);
	          htmlStr = m_html.replaceAll(""); //过滤html标签

	          textStr = htmlStr;
	     }catch(Exception e){
	     }
	     return textStr.replaceAll("&nbsp;", "");//返回文本字符串
	 }  
	
	/**
	 * 通过UA获取手机系统
	 * @param ua
	 * @return
	 */
	public static String getModel(String ua) {
		if(ua == null) {
			return "android";
		}
		if(ua.toLowerCase().contains("android")) {
			return "android";
		} else if(ua.toLowerCase().contains("iphone")) {
			return "iphone";
		} else {	
			return "android";
		}
	}

	/**
	 * 改变IOS字体大小
	 * @param str
	 * @return
	 */
	public static Object changeIOSFontSize(String str) {
		try {
			Pattern p = Pattern.compile("font-size: ");
			Matcher m = p.matcher(str);
			while(m.find()) {
				Integer size = Integer.parseInt(str.substring(m.start() + 11, m.start() + 13)) * 3;
				str = str.substring(0, m.start()) + "font-size: " + size + str.substring(m.start() + 13);
			}
		} catch (NumberFormatException e) {
			e.printStackTrace();
		}
		return str;
	}
	
}